package edu.wfu.preparedDishes.order.dao;

import edu.wfu.preparedDishes.commodity.entity.CommoditySkuEntity;
import edu.wfu.preparedDishes.order.entity.po.OrderEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import edu.wfu.preparedDishes.order.entity.vo.AddressVo;
import edu.wfu.preparedDishes.order.entity.vo.DishesShowVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 订单表;
 * 
 * @author tyy
 * @email tyy2019843259@gmail.com
 * @date 2023-11-21 16:29:10
 */
@Mapper
public interface OrderDao extends BaseMapper<OrderEntity> {
    


    int getTotalPrice(@Param("skus") List<String> skus,@Param("userId")String userId);

    Integer createAddress(@Param("addressId")String addressId,@Param("userId")String userId,
                          @Param("contactPerson")String contactPerson, @Param("phoneNumber")Integer phoneNumber,
                          @Param("callName")Integer call, @Param("label")Integer label,
                          @Param("fullAddress")String fullAddress, @Param("isDefault")Integer isDefault);

    List<AddressVo> getAllAddresses(@Param("userId") String userId);

    String getUserId(@Param("openId") String openId);

    DishesShowVo getOneDishesDetails(@Param("skuId") String skuId);

    Integer getNumber(@Param("skuId") String skuId, @Param("userId") String userId);

    String getSrcImages(@Param("skuId")String skuId);

    AddressVo getAddressByAddressId(@Param("addressId") String addressId);

    void clearCart(@Param("userId") String userId);

    void updateOrder(@Param("orderEntity") OrderEntity orderEntity);

    // 通过用户名和订单状态从订单表里获取skuIds
    List<String> getSkuIds(@Param("userId")String userId, @Param("orderStatus")Integer orderStatus);

    String getSkuIdsByCode(@Param("userId")String userId, @Param("orderCode")String orderCode);

    double getTotalPriceTruOrder(@Param("userId")String userId, @Param("orderCode")String orderCode);


}
